package com.unlcn.ils.kas.api.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger2配置文件 启动后访问地址：http://localhost:8080/swagger-ui.html create by Felix
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
                .apis(RequestHandlerSelectors.basePackage("com.unlcn.ils.kas.api")).paths(PathSelectors.any()).build();
    }

    // Swagger页面初始化内容
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("ILS-KAS开放API")
                .description("ILS-KAS开放API提供：1.第三方物流的整车运输信息查询接口;2.反馈结算参数给JMC的SAP").termsOfServiceUrl(" ")
                .version("1.0.0").build();
    }
}
